<?php
session_start();//开启session
if(!isset($_SESSION['username'])){
    //session中username不存在时
    $data['state']=false;
    $data['msg']='请登陆';  
    echo json_encode($data);  
    exit;
}
?>